﻿using System;

using Storm.TextEditor.Core;

namespace Storm.TextEditor.Drawing.GDI
{
    public abstract class GDIObject
        : IDisposable
    {
        #region Fields

        protected bool created = false;

        #endregion

        #region Methods

        #region Protected

        protected virtual void Destroy()
        {
            created = false;
            MemoryHandler.Remove(this);
        }

        protected virtual void Create()
        {
            created = true;
            MemoryHandler.Add(this);
        }

        #endregion

        #endregion

        #region IDisposable Members

        public void Dispose()
        {
            this.Destroy();
        }

        #endregion
    }
}
